window.onload = function () {
    document.getElementById("technological-stting").className = "add_class";
    document.getElementById("technological").className = "add-nav-active";
    window.TableJson = undefined;
};


// 控制表单、流程导航
function Control_navigation(ele_id) {
    if (ele_id === "definition-flow"){
        document.getElementById(ele_id).className = "basic basic-tabs";
        document.getElementById("create-flow").className = "basic";
        document.getElementById("create-menu").className = "basic";
        document.getElementById("definition").style.display = "inline-block";
        document.getElementById("flow").style.display = "none";
        document.getElementById("menu").style.display = "none";
        document.getElementById("add_station").innerHTML = "下一步";
        document.getElementById("add_station").setAttribute("onclick", "check_val()");
    }else if (ele_id === "create-menu") {
        if (check_val()){
            document.getElementById(ele_id).className = "basic basic-tabs";
            document.getElementById("create-flow").className = "basic";
            document.getElementById("definition-flow").className = "basic";
            document.getElementById("menu").style.display = "inline-block";
            document.getElementById("flow").style.display = "none";
            document.getElementById("definition").style.display = "none";
            document.getElementById("add_station").innerHTML = "下一步";
            document.getElementById("add_station").setAttribute("onclick", "obtain_table()");
        }
    }else {
        if (obtain_table()){
            document.getElementById(ele_id).className = "basic basic-tabs";
            document.getElementById("create-menu").className = "basic";
            document.getElementById("definition-flow").className = "basic";
            document.getElementById("flow").style.display = "inline-block";
            document.getElementById("menu").style.display = "none";
            document.getElementById("definition").style.display = "none";
            document.getElementById("add_station").setAttribute("onclick", "Export()");
            document.getElementById("add_station").innerHTML = "提交";
        }
    }
}


// 检查表单名称
function check_val() {
    var table_name = document.getElementById("table_name").value;
    if (!table_name){
        alert("请输入表单名称");
        return false
    }else {
        var regimentation = document.getElementById("regimentation").value;
        if (!regimentation){
            alert("请输入或选择流程类别");
            return false
        }else {
            document.getElementById("create-menu").click();
            document.getElementById("add_station").setAttribute("onclick", "obtain_table()");
            return true
        }
    }
}


// 定义表单下一步
function obtain_table() {
    var TableJson = window.TableJson;
    if (typeof(TableJson) === "undefined"){
        alert("请定义表单");
        return false
    }else {
        document.getElementById("add_station").setAttribute("onclick", "Export()");
        document.getElementById("add_station").innerHTML = "提交";
        document.getElementById("create-flow").click();
        return true
    }
}
